<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="shortcut icon" href="__IMG__/favicon.ico" />
		<link rel="bookmark" href="__IMG__/favicon.ico" type="image/x-icon" 　/>
		<title>交易记录</title>
		<link rel="stylesheet" type="text/css" href="__CSS__/mui.min.css"/>
		<link rel="stylesheet" type="text/css" href="__CSS__/swiper-3.4.2.min.css"/>
		<link rel="stylesheet" type="text/css" href="__CSS__/common.css"/>
		<link rel="stylesheet" type="text/css" href="__CSS__/index.css"/>
		<script src="__JS__/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="__JS__/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" charset="utf-8">
	      	mui.init();
       </script>
		<style>
			.lottry_box_div table{
				width: 100%;
				text-align: center;
				border:none;
			}
			.lottry_box_div table tr td{
				width: 25%;
				text-align: center;
				padding:10px 2px;
			}
			.lottry_box_div table tr{
				border-bottom: 1px solid #efefef;

			}
			.lottry_box_div{
				max-height: 500px;
				overflow: auto;
			}
		</style>
    </head>
	<body>
		<header class="mui-bar mui-bar-nav" >
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title" style="width:70%" >交易记录({$hall_name})</h1>
		</header>
		<div class="mui-content" style="padding-bottom: 0px;">
		    <div class="container">
			<div class="swiper-container swiper1">
				<div class="swiper-wrapper">
					<input type="hidden" id="cate" value="{$cate}">
					<input type="hidden" id="hall" value="{$hall}">
					<input type="hidden" id="page" value="{$data.now_page}">
					<div class="swiper-slide selected" ><a href="#">全部</a></div>
				</div>
			</div>
			<!-- swiper2 -->
			<div class="swiper-container swiper2">
				<div class="swiper-wrapper">
					<div class="swiper-slide swiper-no-swiping">
						<form action="{:url('',array('cate'=>$cate))}">
						<div style="width: 100%;background-color: #fff;" class="time_box">
							<span>
								起
							  <input type="text" class="demo-input" style="height: 25px" value="{$_GET['start'] ?? ''}" name="start" placeholder="请选择日期" id="test1" lay-key="1">
							</span><span>
								止
							  <input type="text" class="demo-input" style="height: 25px" value="{$_GET['end'] ?? ''}" name="end" placeholder="请选择日期" id="test2" lay-key="2">
							</span>
							<span>
								<input type="button" onclick="submit()"  value="查询" />
							</span>
						</div>
						</form>
						<ul class="lottry_box clearfix bor_b">
							<li><a href="javascript:void(0);">期数</a></li>
							<li><a href="javascript:void(0);">时间</a></li>
							<li><a href="javascript:void(0);">投注</a></li>
							<li><a href="javascript:void(0);">中奖</a></li>
						</ul>
						<div class="lottry_box_div">
							<table class="inner">
								{foreach $data['data'] as $k=>$v}
										<tr>
											 {if $cate!=13 && $cate!=14}
											   <td><a href="{:url('lottery/history',array('cate'=>$v['cate'],'stage'=>$v['stage']))}" style="color:#12C2FE ">{$v['stage']}</a>
												   <p>{$v['name']}</p>
											   </td>
											{else/}
											  <td><a href="#" style="color:#12C2FE ">{$v['stage']}
												  <p>{$v['name']}</p>
											  </a>
											  </td>
											{/if}

											<td>{$v['create_at']|date="m-d H:i",###}
												<p>{$v['nickname']}</p>
											</td>
											<td>{$v['number']}
												<p>{$v['money']}</p>
											</td>
											{if $v['state']==0}
												<td style="color: red">未开奖({$v['money']})</td>
											{elseif $v['state']==1}
												{if $v['code']==0}
												<td>未中奖(-{$v['money']})</td>
													{else/}
											    <td style="color:#12C2FE ">中奖(+{$v['z_money']})</td>
													{/if}
											{/if}
										</tr>
								{/foreach}
							</table>
						</div>
					</div>
				</div>
			</div>
		   </div>
		</div>

        <script src="__JS__/swiper-3.4.2.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="__JS__/laydate/laydate.js" type="text/javascript" charset="utf-8"></script>
		<script src="__JS__/laydate.js" type="text/javascript" charset="utf-8"></script>
		<script src="__JS__/index.js" type="text/javascript" charset="utf-8"></script>
		<script src="__JS__/zepto.min.js"></script>
		<script src="__JS__/dropload.min.js"></script>
		<script>
			$(window).scroll(function(){

				totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
				if($(document).height() <= totalheight){
				    var hall    = $('#hall').val();
					var my_cate = $('#cate').val();
					var page    = parseInt($('#page').val())+1;
					console.log($('#page').val());
					$.ajax({
						type: 'GET',
						url: "{:url('mine/proxy_transaction_record_api')}",
						data:{'page':page,'cate':my_cate,'hall':hall},
						dataType: 'json',
						success: function(data){
							var cate     = data.data.cate;
							var my       = data.data.data;
							var now_page = data.data.now_page;
							console.log(now_page);
							var result = '';
							for(var i = 0; i < my.length; i++){
								var state = my[i].state;
								var code  = my[i].code;
								result += " <tr>" ;
								if(cate!=13 && cate!=14){
                                    var url = "{:url('lottery/history')}"+"?cate="+my[i].cate+"&stage="+my[i].stage;
									result+="<td><a href='"+url+"'  style='color:#12C2FE'>"+my[i].stage+"</a>"
							              +"<p>"+my[i].name+"</p>" +"</td>";
								}else{
									result+="<td><a href='#' style='color:#12C2FE '>"+my[i].stage+"</a>"
											+"<p>"+my[i].name+"</p>" +"</td>";
								}
									result+="<td>"+my[i].create_at
                                           +"<p>"+my[i].nickname+"</p>" +"</td>"
					                       +"<td>"+my[i].number
							               +"<p>"+my[i].money+"</p>"
								           +"</td>";
								if(state==0){
								        result+="<td style='color: red'>未开奖("+my[i].money+")</td>";
								}else if(state==1){
									if(code==1){
										result+="<td style='color: #12C2FE'>中奖(+"+my[i].z_money+")</td>";
									}else{
										result+="<td>未中奖(-"+my[i].money+")</td>";
									}
								}
								result += " </tr>" ;
                                $('#page').val(now_page)

							}

							// 为了测试，延迟1秒加载
							setTimeout(function(){
								$('.inner').append(result);
								// 每次数据加载完，必须重置
							},100);
						},
						error: function(xhr, type){
							alert('Ajax error!');
						}
					});
				}
			});
		</script>
	</body>
</html>
